<?php

class Core_Form_Admincp_Setting_Mail extends Nuo_Form
{
	function init()
	{
		$host = Nuo::getRequest()->getHttpHost();

		$this -> setTitle('Mail Setting') -> setDesc('form-desc.Mail Setting');

		$this -> addChild('text', 'mail_config_from_name', array(
			'label' => 'form-label.Mail From Name',
			'desc' => 'form-desc.Mail From Name',
			'value' => 'administrators',
		));

		$this -> addChild('text', 'mail_config_from_address', array(
			'label' => 'form-label.Mail From Address',
			'desc' => 'form-desc.Mail From Address',
			'value' => 'admin@' . $host,
		));

		$this -> addChild('text', 'mail_config_reply_address', array(
			'label' => 'form-label.Mail Reply Address',
			'desc' => 'form-desc.Mail Reply Address',
			'value' => 'no-reply@' . $host,
		));
		
		$this -> addChild('text', 'mail_config_reply_name', array(
			'label' => 'form-label.Mail Reply Name',
			'desc' => 'form-desc.Mail Reply Name',
			'value' => 'no-reply',
		));

		$this -> addChild('radio', 'mail_config_adapter', array(
			'multiOptions' => array(
				'mail' => 'PHP Built-In Mail Function',
				'smtp' => 'SMTP Protocol'
			),
			'value' => 'mail',
			'label' => 'form-label.Mail Adapter',
			'desc' => 'form-desc.Mail Adapter',
		));

		$this -> addChild('text', 'mail_config_smtp_host', array(
			'label' => 'form-label.SMTP Host',
			'desc' => 'form-desc.SMTP Host',
			'value' => $host,
		));

		$this -> addChild('text', 'mail_config_smtp_port', array(
			'label' => 'form-label.SMTP Port',
			'desc' => 'form-desc.SMTP Port',
			'value' => 25,
		));

		$this -> addChild('yesno', 'mail_config_smtp_auth', array(
			'label' => 'form-label.SMTP Authentication',
			'desc' => 'form-desc.SMTP Authentication'
		));

		$this -> addChild('text', 'mail_config_smtp_username', array(
			'label' => 'form-label.SMTP Username',
			'desc' => 'form-desc.SMTP Username'
		));

		$this -> addChild('text', 'mail_config_smtp_password', array(
			'label' => 'form-label.SMTP Password',
			'desc' => 'form-desc.SMTP Password'
		));

		$this -> addChild('radio', 'mail_config_smtp_secure', array(
			'label' => 'form-label.SMTP Secure Protocol',
			'desc' => 'form-desc.SMTP Secure Protocol',
			'multiOptions' => array(
				'' => 'None',
				'ssl' => 'SSL',
				'tsl' => 'TSL',
			),
			'value' => 'none',
		));

		$this -> addChild('group', '_footer');

		$this -> _footer -> addChild('submit', '_submit') -> addChild('button', '_test', array('label' => 'Test')) -> addChild('cancel', '_cancel');

	}

}
